在 MacOS 上安裝 pycurl。(鏈接時 ssl 後端(無/其他)與編譯時 ssl 後端(openssl)不同) (Installing pycurl on MacOS. (link-time ssl backend (none/other) is different from compile-time ssl backend (openssl)))


問題描述

在 MacOS 上安裝 pycurl。(鏈接時 ssl 後端(無/其他)與編譯時 ssl 後端(openssl)不同) (Installing pycurl on MacOS. (link‑time ssl backend (none/other) is different from compile‑time ssl backend (openssl)))

我正在嘗試在 MacOS Sierra 上的 venv 中安裝 pycurl。我已經清理乾淨,通過 brew 安裝了 openssl,告訴 pip 鏈接到該 openssl 安裝並嘗試加載模塊。它抱怨“none/other”與“openssl”不同。

ImportError: pycurl: libcurl link‑time ssl backend (none/other) is different from compile‑time ssl backend (openssl)

似乎包按預期編譯,但它試圖加載錯誤的 ssl 庫。關於解決這個問題有什麼建議嗎?谷歌搜索後我嘗試了谷歌搜索。

完整安裝嘗試:

(venv) R5106464:venv m106093$ brew uninstall openssl
Error: No such keg: /usr/local/Cellar/openssl
(venv) R5106464:venv m106093$ pip uninstall pycurl
Skipping pycurl as it is not installed.
(venv) R5106464:venv m106093$ brew install openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl‑1.0.2q.sierra.bottl
Already downloaded: /Users/m106093/Library/Caches/Homebrew/downloads/b6dec2b57ee88a3cb02335284971b3b1e902d8b43fef115b456a971e5d0981ce‑‑openssl‑1.0.2q.sierra.bottle.tar.gz
==> Pouring openssl‑1.0.2q.sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg‑only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="‑L/usr/local/opt/openssl/lib"
  export CPPFLAGS="‑I/usr/local/opt/openssl/include"

For pkg‑config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2q: 1,794 files, 12.3MB
(venv) R5106464:venv m106093$ PYCURL_SSL_LIBRARY=openssl LDFLAGS="‑L/usr/local/opt/openssl/lib" CPPFLAGS="‑I/usr/local/opt/openssl/include" pip install ‑‑no‑cache‑dir pycurl
Collecting pycurl
  Downloading https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl‑7.43.0.2.tar.gz (214kB)
    100% |████████████████████████████████| 215kB 3.6MB/s 
Installing collected packages: pycurl
  Running setup.py install for pycurl ... done
Successfully installed pycurl‑7.43.0.2
(venv) R5106464:venv m106093$ python
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycurl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: pycurl: libcurl link‑time ssl backend (none/other) is different from compile‑time ssl backend (openssl)
>>> 

參考解法

方法 1:

hello i have this problem whit python 3.8 in Mac OS Mojave I solve from:

sudo ‑H pip uninstall pycurl

brew install openssl

PYCURL_SSL_LIBRARY=openssl

pip install ‑‑no‑cache‑dir ‑‑global‑option=build_ext ‑‑global‑option="‑L/usr/local/opt/openssl/lib" ‑‑global‑option="‑I/usr/local/opt/openssl/include" ‑‑user pycurl

and now is working PycURL

(by Davepez‑nuss labs)

參考文件

  1. Installing pycurl on MacOS. (link‑time ssl backend (none/other) is different from compile‑time ssl backend (openssl)) (CC BY‑SA 2.5/3.0/4.0)

#pycurl #macos-sierra #openssl






相關問題

python中的握手失敗(_ssl.c:590) (HandShake Failure in python(_ssl.c:590))

SmugMug 的變化似乎炸毀了 pysmug (changes at SmugMug appear to have blown up pysmug)

pycurl/curl 不遵循 CURLOPT_TIMEOUT 選項 (pycurl/curl not following the CURLOPT_TIMEOUT option)

需要幫助從 curl 遷移到 pycurl (need help with moving from curl to pycurl)

Tornado 的 AsyncHTTPClient 從 1.2 升級到 2.0 後不再工作 (Tornado's AsyncHTTPClient no longer works after upgrade to 2.0 from 1.2)

PyCurl 替代方案,libcurl 的 pythonic 包裝器? (PyCurl alternative, a pythonic wrapper for libcurl?)

使用 Pycurl 獲取 HTML (Getting HTML with Pycurl)

如果請求的數據有時被壓縮,有時不被壓縮,如何使用 pycurl? (how to use pycurl if requested data is sometimes gzipped, sometimes not?)

在 MacOS 上安裝 pycurl。(鏈接時 ssl 後端(無/其他)與編譯時 ssl 後端(openssl)不同) (Installing pycurl on MacOS. (link-time ssl backend (none/other) is different from compile-time ssl backend (openssl)))

Python 3.7:在 Windows 10 上安裝 pycurl (Python 3.7: pycurl installation on Windows 10)

Windows 機器在 Thonny 上安裝 pycurl 模塊 (Windows machine Installing pycurl module on Thonny)

當 python 線程在網絡調用(HTTPS)中並且發生上下文切換時會發生什麼? (What happens when the python thread is in network call(HTTPS) and the context switch happens?)







留言討論